<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 400px;
            height: 400px;
            background: skyblue;
        }

        /* ::before 往前追加 */
        div::before {
            /* content设置伪元素的文本内容 */
            content: '我是一个伪元素';
            /* 行内元素 */
            display: block;
            width: 100px;
            height: 100px;
            background: red;
        }

        /* ::after 往后追加一个伪元素 */
        div::after {
            content: "";
            display: block;
            width: 100px;
            height: 100px;
            background: purple;
        }
    </style>
</head>

<body>
    <div>
        <p>5</p>
    </div>
</body>

</html>